package song.demo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import song.demo.bean.UserBean;
import song.demo.service.UserService;

import javax.annotation.Resource;

@Controller
public class LoginController {
    //将Service注入Web层
    @Resource
    UserService userService;
    @RequestMapping("/login")
    public String show(){
        return "login";
    }
    @RequestMapping(value = "/login",method = RequestMethod.POST)
    public String login(String name,String password){
        UserBean userBean = userService.login(name, password);
        if(userBean!=null){
            return "success";
        }else {
            return "error";
        }

    }
}
